//
//  RSShakeVC.m
//  RSTools
//
//  Created by thinkjoy on 2017/10/12.
//  Copyright © 2017年 杜瑞胜. All rights reserved.
//

#import "RSShakeVC.h"

@interface RSShakeVC ()

@end

@implementation RSShakeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor   =   [UIColor whiteColor];
    
    // 设置允许摇一摇功能
    [UIApplication sharedApplication].applicationSupportsShakeToEdit = YES;
    // 并让自己成为第一响应者
    [self becomeFirstResponder];
}

#pragma maerk -- 摇一摇

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{
    if (!(motion == UIEventSubtypeMotionShake)) {
        return;
    }
    NSLog(@"开始摇了，坐稳咯");
}

-  (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event{
    NSLog(@"不摇了，你走吧");
}

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event{
    NSLog(@"摇完了，下车吧");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
